import request from '@/utils/request'

// 查询传感器管理列表
export function listSensor(query) {
  return request({
    url: '/app/sensor/list',
    method: 'get',
    params: query
  })
}

// 查询传感器管理详细
export function getSensor(sensorId) {
  return request({
    url: '/app/sensor/' + sensorId,
    method: 'get'
  })
}

// 新增传感器管理
export function addSensor(data) {
  return request({
    url: '/app/sensor',
    method: 'post',
    data: data
  })
}

// 修改传感器管理
export function updateSensor(data) {
  return request({
    url: '/app/sensor',
    method: 'put',
    data: data
  })
}

// 删除传感器管理
export function delSensor(sensorId) {
  return request({
    url: '/app/sensor/' + sensorId,
    method: 'delete'
  })
}

// 删除传感器管理
export function delSensorAll() {
  return request({
    url: '/app/sensor/all',
    method: 'delete'
  })
}

// 传感器数据权限
export function deptScope(data) {
  return request({
    url: '/app/sensor/deptScope',
    method: 'put',
    data: data
  })
}

// 传感器空间权限
export function placeScope(data) {
  return request({
    url: '/app/sensor/placeScope',
    method: 'put',
    data: data
  })
}


// 根据 传感器ID查询部门树结构
export function deptTreeSelect(sensorId) {
  return request({
    url: '/app/sensor/deptTree/' + sensorId,
    method: 'get'
  })
}

// 根据传感器ID查询空间树结构
export function placeTreeSelect(sensorId) {
  return request({
    url: '/app/sensor/placeTree/' + sensorId,
    method: 'get'
  })
}

export function listSensorAll(query) {
  return request({
    url: '/app/sensor/all',
    method: 'get',
    params: query
  })
}
